//
//  GRStoreGoodTableViewCell.m
//  YC_GRice
//
//  Created by luojinrong11 on 2018/8/24.
//  Copyright © 2018年 YeCai. All rights reserved.
//

#import "GRStoreGoodTableViewCell.h"

@implementation GRStoreGoodTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

    
}
-(void)setDiscountGoodModel:(GRDiscountGoodModel *)discountGoodModel{
    _discountGoodModel = discountGoodModel;
    [self.goodImageView sd_setImageWithURL: [NSURL URLWithString:discountGoodModel.mainPhoto]];
    self.titleLabel.text = discountGoodModel.title;
    self.contentLabel.text = discountGoodModel.content;
    self.priceLabel.text = [NSString stringWithFormat:@"%.2lf",discountGoodModel.discountPrice];
    self.orignalLabel.text = [NSString stringWithFormat:@"%.2lf",discountGoodModel.totalPrice];
    self.saleNumLabel.text = [NSString stringWithFormat:@"已售%ld份",discountGoodModel.saleNumber];
    
}

- (IBAction)buyAction:(id)sender {
    if (_delegate && [_delegate respondsToSelector:@selector(purchaseAction:)]) {
        [_delegate purchaseAction:self.discountGoodModel.id];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
